﻿@{
    ViewBag.Title = "Users";
    Layout = "~/Views/Shared/_LayoutSysAdmin.cshtml";
}

<h2>Users</h2>
<a class="btn btn-sm btn-default">Add user</a>

<table class="table table-striped" data-bind="css:{hide:!users().length}">
    <thead>
        <tr>
            <th>Name</th>
            <th>Email</th>
            <th>Last update</th>
            <th>Status</th>
            <th>Action</th>
        </tr>
    </thead>
    <tbody data-bind="foreach:users">
        <tr>
            <td data-bind="text: name"></td>
            <td data-bind="text: email"></td>
            <td data-bind="text: lastUpdated"></td>
            <td>
                <div data-bind="if: isVerified">
                    <span class="label label-success">Verified</span>
                </div>
                <span data-bind="if: !isVerified()" class="label label-danger">Not Verified</span>
                <span data-bind="if: allowLogin" class="label label-success">Allow login</span>
                <div data-bind="if: !allowLogin">
                    <span class="label label-success">Not login</span>
                </div>
            </td>
            <td>
                @{ var url = @Url.Action("Manage"); }

                <div class="btn-group pull-right">
                    <a class="btn btn-sm  dropdown-toggle" data-toggle="dropdown" href="#">
                        <span class=" glyphicon glyphicon-cog"></span>
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li>
                            <a href="#" data-confirm="Are you sure?" data-method="put" rel="nofollow">
                                <span class="glyphicon glyphicon-briefcase"></span>
                                Edit
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a data-bind="click: function (data, evt) { $parent.deleteUser(data) }">
                                <span class="glyphicon glyphicon-trash"></span>
                                Delete
                            </a>
                        </li>

                    </ul>
                </div>
                <a class="btn btn-sm btn-default pull-right" data-bind="attr: { href: '@url#' + $data.id() }">Manage</a>
            </td>
        </tr>
    </tbody>
</table>
@section scripts{
    <script src="~/Scripts/app/users.js"></script>
}



